package com.zhangshanfeng.test;

import java.util.Comparator;
import java.util.TreeSet;

public class TreeSetDemo04 {
    public static void main(String[] args) {
        TreeSet<Student2> ts = new TreeSet<Student2>(new Comparator<Student2>() {
            @Override
            public int compare(Student2 o1, Student2 o2) {
                int result = o1.getChinese() - o2.getChinese();
                result = result == 0 ? o1.getMath() - o2.getMath() : result;
                result = result == 0 ? o1.getName().compareTo(o2.getName()) : result;
                return result;
            }
        });


    }
}
